home *** CD-ROM | disk | FTP | other *** search
- /*
- dirent.h -- file system independant directory access for MPW.
-
- Copyright (c) 1993 Anthony C. Ard.
-
- This program is free software; you can redistribute it and/or
- modifiy it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
- #ifndef dirent_h
- #define dirent_h
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- struct dirent {
- long d_ino; /* inode number of entry */
- off_t d_off; /* offset of disk directory entry */
- unsigned short d_reclen; /* length of this record */
- char d_name[255]; /* name of file */
- };
-
- /* The following nonportable ugliness could have been avoided by defining
- DIRENTSIZ and DIRENTBASESIZ to also have (struct dirent *) arguments.
- There shouldn't be any problem if you avoid using the DIRENTSIZ() macro. */
-
- #define DIRENTBASESIZ (((struct dirent *)0)->d_name \
- - (char *)&((struct dirent *)0)->d_ino)
-
- #define DIRENTSIZ( namlen ) ((DIRENTBASESIZ + sizeof(long) + (namlen)) \
- / sizeof(long) * sizeof(long))
-
- #define MAXNAMLEN 63
-
- #ifndef NAME_MAX
- #define NAME_MAX (MAXNAMLEN - 1)
- #endif
-
- #define DIRBUF 8192
-
- typedef struct {
- int dd_fd;
- int dd_loc;
- int dd_size;
- char *dd_buf;
- } DIR;
-
- DIR *opendir( char *dirname );
- struct dirent *readdir( register DIR *dirp );
- off_t telldir( DIR *dirp );
- void seekdir( register DIR *dirp, register off_t loc );
- void rewinddir( register DIR *dirp );
- int closedir( register DIR *dirp );
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif dirent_h
-